﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/*
    2012-2-17 David检查正常
 */
namespace Benefit.Models.Sys
{
    /// <summary>
    /// 为交易员配置小组
    /// </summary>
    public class GroupOperators
    {
        public int Id { get; set; }

        public int GroupId { get; set; }

        public virtual Groups Group { get; set; }

        public int OperatorId { get; set; }

        public Operator Operator { get; set; }


        //public void AddGroupOperators(DB.DBManager db)
        //{
        //    GroupOperators dgos = new GroupOperators();
        //    dgos.GroupId = this.GroupId;
        //    dgos.OperatorId = this.OperatorId;
        //    db.GroupOperators.Add(dgos);
        //    db.SaveChanges();
        //}

        //public List<GroupOperators> GetList(DB.DBManager db)
        //{
        //    var query = db.GroupOperators.ToList();
        //    return query;
        //}

        ///// <summary>
        ///// 在网页中配置账户和操作员关系
        ///// </summary>
        ///// <param name="oas"></param>
        //public void ResetOperatorGroups(List<GroupOperators> gas, DB.DBManager db)
        //{
        //    foreach (GroupOperators account in gas)
        //    {
        //        var query = db.GroupOperators.Where(a => a.OperatorId == account.OperatorId);
        //        if (query.Count() > 0)
        //        {
        //            GroupOperators a = query.First();
        //            a.GroupId = account.GroupId;
        //        }
        //        else
        //        {
        //            db.GroupOperators.Add(account);
        //        }
        //    }
        //    db.SaveChanges();
        //}
        ///// <summary>
        ///// 得到一个组的所有组员
        ///// </summary>
        ///// <param name="groupid"></param>
        ///// <param name="db"></param>
        ///// <returns></returns>
        //public List<GroupOperators> GetGroupOperators(int groupid, DB.DBManager db)
        //{
        //    return db.GroupOperators.Where(a => a.GroupId == groupid).ToList();
        //}
    }
}